# $Id: Makefile,v 1.18 2007/03/13 19:14:14 sby Exp $

.include "../include/mythbbs.mk"

LDFLAGS+=	-lcompat -export-dynamic -levent

BBS_SOURCE=	announce.c bbs.c board.c brc.c cache.c edit.c user.c \
		mail.c menu.c more.c name.c read.c record.c osdep.c \
		stuff.c talk.c list.c visio.c favor.c var.c mbbsd.c

SRC =	$(BBS_SOURCE)

OBJ =	$(SRC:.c=.o)

PRO =	$(SRC:.c=.x)

EXE =	mbbsd

ETC =	Makefile

.SUFFIXES: .o .c .x

.c.o:	../include/var.h
	$(CCACHE) $(CC) $(CFLAGS) $(OS_DEF) -c $*.c

.c.x:	$(CPROTO) -o $*.x $*.c

GARBAGE = proto.x *~ vers.c

all: $(EXE)

../include/var.h:	var.c
	perl ../util/parsevar.pl < var.c > ../include/var.h

$(EXE): $(OBJ) $(ETC)
	sh ../util/newvers.sh
	$(CC) -o $(EXE) $(CFLAGS) $(OBJ) $(LDFLAGS) vers.c

install: $(EXE)
	ls -l $(EXE)
	install -d $(BBSHOME)/bin/
	install -c -m 755 $(EXE) $(BBSHOME)/bin/

MYTH.p: $(SRC)
	$(CPROTO) -o $@ $?

proto.x: $(PRO)
	/bin/rm	-f proto.x
	/bin/cat $(PRO) > proto.x

clean:
	rm -fr $(GARBAGE) $(OBJ) $(EXE) $(PRO)

tags:
	ctags $(SRC)

